package tech.aistar.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.Cost;

import java.util.List;

public interface CostMapper {
    @Select("select * from cost")
    List<Cost> selectAll();
    @Insert("insert into cost(house_id,rent_money,deposit,service_tip) value(#{houseId},#{rentMoney},#{deposit},#{serviceTip})")
    void insert(Cost cost);
    @Update("update cost set house_id=#{houseId},rent_money=${rentMoney},deposit=${deposit},service_tip=#{serviceTip} where id=#{Id}")
    void  updateByPrimaryKey(Cost cost);

    @Delete("delete from cost where id=#{Id}")
    void deleteByPrimaryKey(Integer id);


    @Select("select * from cost where id=#{Id}")
    Cost findById(Integer integer);

    @Select("select * from cost where house_id=#{houseId}")
    Cost findByhouseId(Integer integer);
}
